package Listeners;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import GUI.ConferenceWizardFrame;
import GUI.SubmitPaperPanel;
import Model.Conference;
import Model.User;

/**
 * Listener for the "Submit Paper" button in the AuthorToolPanel.
 * 
 * Allows the user(Author) to add a paper to the conference by taking
 * them to the SubmitPaperPanel to enter the data for the new paper.
 * 
 * @author Paul Schultz
 * @version 11/30/2012
 */
@SuppressWarnings("serial")
public class SubmitNewPaperListener extends AbstractAction
{
  
  private Conference my_conference;
  private User my_author;
  private ConferenceWizardFrame my_frame;
  
  /**
   * Constructs a new SubmitNewPaperListener.
   * 
   * @param the_conf The conference the paper will be added to.
   * @param the_frame The master frame for this application.
   * @param the_author The author of the new paper.
   */
  public SubmitNewPaperListener(final Conference the_conf, 
      ConferenceWizardFrame the_frame, User the_author)
  {
    my_conference = the_conf;
    my_author = the_author;
    my_frame =  the_frame;
    
  }

  /**
   * Changes the current panel being view to the SubmitPaperPanel.
   */
  @Override
  public void actionPerformed(ActionEvent arg0)
  {
    my_frame.setCurrentPanel(new SubmitPaperPanel(my_author, my_conference, my_frame));
    
  }

}
